<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/component/pear/css/pear.css"/>
    <link rel="stylesheet" href="/admin/css/other/console1.css"/>
    <style>
        .layui-form-label.required:after {
            content: ' *';
            color: red;
        }

        .layui-form-label {
            width: 100px;
        }

        .layui-input-block {
            margin-left: 130px !important;
        }

        .inputSetting {
            background-color: #301616;
        }

        .layui-card {
            margin-bottom: 10px;
        }
    </style>
</head>
<body class="pear-container">
<div>
    <div class="layui-row layui-col-space10">
        <div class="layui-col-md6">
            <div class="layui-card">
                <div class="layui-card-header">参数监控</div>
                <div class="layui-card-body">
                    <form class="layui-form" action="" onsubmit="return false">
                        <form class="layui-form" action="" onsubmit="return false">
                            <div class="layui-form-item">
                                <label class="layui-form-label">当前层:</label>
                                <div class="layui-input-inline">
                                    <select name="layer" lay-verify="required" lay-search>
                                        <option value="">请选择层</option>
                                        <option th:each="layer : ${layerList}" th:value="${layer}"
                                                th:selected="${currentLayer} eq ${layer}" th:text="${layer}"></option>
                                    </select>
                                </div>
                                <div class="layui-form-item layui-inline">
                                    <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                            lay-filter="layerSettings">
                                        <i class="layui-icon layui-icon-search"></i>
                                        保存
                                    </button>
                                    <button type="reset" class="pear-btn pear-btn-md">
                                        <i class="layui-icon layui-icon-refresh"></i>
                                        重置
                                    </button>
                                </div>
                            </div>
                        </form>
                    </form>
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item">
                            <label class="layui-form-label">LED:</label>
                            <div class="layui-input-inline">
                                <input type="number" name="ledNumber" placeholder="请输入选择列数" id="LED"
                                       autocomplete="off"
                                       oninput="checkVal()"
                                       lay-verify="number"
                                       class="layui-input">
                            </div>
                            <div class="layui-input-inline">
                                <input type="radio" name="ledStatus" value="1" title="亮" checked>
                                <input type="radio" name="ledStatus" value="0" title="灭">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="ledSubmit">确定</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">LED依次亮:</label>
                            <button class="pear-btn  pear-btn-primary" id="ledTurnsOnInTurn" lay-submit
                                    lay-filter="ledTurnsOnInTurn">确定
                            </button>
                        </div>
                    </form>
                </div>
            </div>
            <div class="layui-card">
                <div class="layui-card-header">柜体设置</div>
                <div class="layui-card-body" style="min-height: 254px;">
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item">
                            <label class="layui-form-label">设置柜体层数:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="numberOfLayers" th:value="${numberOfLayers}"
                                       lay-verify="required|number" lay-reqtext="请输入层距离"
                                       placeholder="请输入输入框内容"
                                       autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="cabinetLayers">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                    <form class="layui-form" action="" onsubmit="return false" style="margin-top: 0px">
                        <div class="layui-form-item">
                            <label class="layui-form-label">设置柜体列数:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="numberOfColumns" th:value="${numberOfColumns}"
                                       lay-verify="required|number" lay-reqtext="请输入层距离"
                                       placeholder="请输入输入框内容"
                                       autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="numberOfCabinetColumns">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item">
                            <label class="layui-form-label">RFID功能:</label>
                            <div class="layui-input-inline">
                                <input type="radio" name="RFID" th:checked="${ RFID == '1'}? 'true':'false'" value="1"
                                       title="开启">
                                <input type="radio" name="RFID" th:checked="${ RFID == '0'}? 'true':'false'" value="0"
                                       title="关闭" checked>
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="RFIDSave">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                    <form class="layui-form" action="" onsubmit="return false" id="rfidReading">
                        <div class="layui-form-item">
                            <label class="layui-form-label">RFID实时读取:</label>
                            <div class="layui-input-inline">
                                <input type="radio" name="real_time_read"
                                       th:checked="${ real_time_read == '1'}? 'true':'false'" value="1"
                                       title="开启">
                                <input type="radio" name="real_time_read"
                                       th:checked="${ real_time_read == '0'}? 'true':'false'" value="0"
                                       title="关闭" checked>
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="realTimeRead">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item">
                            <label class="layui-form-label">时间校准:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="datetime" lay-verify="required|datetime"
                                       lay-reqtext="请选择时间" class="layui-input" id="time">
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="datetimeSave">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            <div class="layui-card">
                <div class="layui-card-header">系统设置</div>
                <div class="layui-card-body">
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item">
                            <label class="layui-form-label">登录方式:</label>
                            <div class="layui-input-inline">
                                <input type="radio" name="login_type" th:checked="${ login_type == '1'}? 'true':'false'"
                                       value="1"
                                       title="本地">
                                <input type="radio" name="login_type" th:checked="${ login_type == '2'}? 'true':'false'"
                                       value="2"
                                       title="远程" checked>
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="loginTypeSave">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item">
                            <label class="layui-form-label">设置用户密码:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="userPassword" th:value="${userPassword}" required
                                       lay-verify="required" lay-reqtext="请输入用户密码"
                                       placeholder="请输入输入框内容"
                                       autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="userPassword">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item">
                            <label class="layui-form-label">设置屏幕尺寸:</label>
                            <div class="layui-input-inline ">
                                <input type="text" lay-verify="required|number" lay-reqtext="请输入屏幕尺寸"
                                       name="setScreenSize"
                                       autocomplete="off"
                                       class="layui-input" th:value="${setScreenSize}">
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="setScreenSize">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item layui-inline">
                            <label class="layui-form-label">恢复初始密码:</label>
                            <button class="pear-btn  pear-btn-warming" id="restoreInitialPassword" lay-submit
                                    lay-filter="restoreInitialPassword">重置
                            </button>
                            <label class="layui-form-label"
                                   style="float: none;display: inline;margin-left: 23px;">重启控制器:</label>
                            <button class="pear-btn pear-btn-primary" load> 重启</button>&nbsp;&nbsp
                        </div>
                    </form>
                </div>
            </div>
            <div class="layui-card">
                <div class="layui-card-header">报警设置</div>
                <div class="layui-card-body">
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item">
                            <label class="layui-form-label">温度上限:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="temperatureUpper" th:value="${temperature_upper}" required
                                       lay-verify="required|number" lay-reqtext="请输入层距离"
                                       placeholder="请输入输入框内容"
                                       autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="alertSave">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item">
                            <label class="layui-form-label">湿度上限:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="humidityUpper" th:value="${humidity_upper}" required
                                       lay-verify="required|number" lay-reqtext="请输入层距离"
                                       placeholder="请输入输入框内容"
                                       autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="alertSave">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <div class="layui-col-md6">
            <div class="layui-card">
                <div class="layui-card-header">层位置设置</div>
                <div class="layui-card-body">
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item" style="display: none">
                            <div class="layui-input-inline">
                                <input type="text" name="layer" placeholder="" class="layui-input" value="pulse1">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">层1:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="pulse" required th:value="${pulse1}"
                                       lay-verify="required|number" lay-reqtext="请输入层距离"
                                       placeholder="请输入输入框内容"
                                       autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="pulseSubmit">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item" style="display: none">
                            <div class="layui-input-inline">
                                <input type="text" name="layer" placeholder="" class="layui-input" value="pulse2">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">层2:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="pulse" required th:value="${pulse2}"
                                       lay-verify="required|number" lay-reqtext="请输入层距离"
                                       placeholder="请输入输入框内容"
                                       autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="pulseSubmit">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item" style="display: none">
                            <div class="layui-input-inline">
                                <input type="text" name="layer" placeholder="" class="layui-input" value="pulse3">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">层3:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="pulse" required th:value="${pulse3}"
                                       lay-verify="required|number" lay-reqtext="请输入层距离"
                                       placeholder="请输入输入框内容"
                                       autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="pulseSubmit">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item" style="display: none">
                            <div class="layui-input-inline">
                                <input type="text" name="layer" placeholder="" class="layui-input" value="pulse4">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">层4:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="pulse" required th:value="${pulse4}"
                                       lay-verify="required|number" lay-reqtext="请输入层距离"
                                       placeholder="请输入输入框内容"
                                       autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="pulseSubmit">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item" style="display: none">
                            <div class="layui-input-inline">
                                <input type="text" name="layer" placeholder="" class="layui-input" value="pulse5">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">层5:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="pulse" required th:value="${pulse5}"
                                       lay-verify="required|number" lay-reqtext="请输入层距离"
                                       placeholder="请输入输入框内容"
                                       autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="pulseSubmit">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item" style="display: none">
                            <div class="layui-input-inline">
                                <input type="text" name="layer" placeholder="" class="layui-input" value="pulse6">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">层6:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="pulse" required th:value="${pulse6}"
                                       lay-verify="required|number" lay-reqtext="请输入层距离"
                                       placeholder="请输入输入框内容"
                                       autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="pulseSubmit">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item" style="display: none">
                            <div class="layui-input-inline">
                                <input type="text" name="layer" placeholder="" class="layui-input" value="pulse7">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">层7:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="pulse" required th:value="${pulse7}"
                                       lay-verify="required|number" lay-reqtext="请输入层距离"
                                       placeholder="请输入输入框内容"
                                       autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="pulseSubmit">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item" style="display: none">
                            <div class="layui-input-inline">
                                <input type="text" name="layer" placeholder="" class="layui-input" value="pulse8">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">层8:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="pulse" required th:value="${pulse8}"
                                       lay-verify="required|number" lay-reqtext="请输入层距离"
                                       placeholder="请输入输入框内容"
                                       autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="pulseSubmit">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item" style="display: none">
                            <div class="layui-input-inline">
                                <input type="text" name="layer" placeholder="" class="layui-input" value="pulse9">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">层9:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="pulse" required th:value="${pulse9}"
                                       lay-verify="required|number" lay-reqtext="请输入层距离"
                                       placeholder="请输入输入框内容"
                                       autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="pulseSubmit">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item" style="display: none">
                            <div class="layui-input-inline">
                                <input type="text" name="layer" placeholder="" class="layui-input" value="pulse10">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">层10:</label>
                            <div class="layui-input-inline">
                                <input type="text" name="pulse" required th:value="${pulse10}"
                                       lay-verify="required|number" lay-reqtext="请输入层距离"
                                       placeholder="请输入输入框内容"
                                       autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="pulseSubmit">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
            <div class="layui-card">
                <div class="layui-card-header">系统调试设置</div>
                <div class="layui-card-body" style="min-height: 230px;">
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item">
                            <label class="layui-form-label">调试模式:</label>
                            <div class="layui-input-inline">
                                <input type="radio" name="debug" th:checked="${ debug == '1'}? 'true':'false'" value="1"
                                       title="开启">
                                <input type="radio" name="debug" th:checked="${ debug == '0'}? 'true':'false'" value="0"
                                       title="关闭" checked>
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="debugSave">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item">
                            <label class="layui-form-label">电机类型:</label>
                            <div class="layui-input-inline">
                                <input type="radio" name="motor_type" th:checked="${ motor_type == '1'}? 'true':'false'"
                                       value="1"
                                       title="步进">
                                <input type="radio" name="motor_type" th:checked="${ motor_type == '0'}? 'true':'false'"
                                       value="0"
                                       title="异步" checked>
                            </div>
                            <div class="layui-form-item layui-inline">
                                <button class="pear-btn pear-btn-md pear-btn-primary" lay-submit
                                        lay-filter="motorTypeSave">
                                    <i class="layui-icon layui-icon-search"></i>
                                    保存
                                </button>
                                <button type="reset" class="pear-btn pear-btn-md">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                    重置
                                </button>
                            </div>
                        </div>
                    </form>
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item">
                            <label class="layui-form-label">更新参数</label>
                            <button class="pear-btn  pear-btn-primary" lay-submit
                                    lay-filter="updateAllParameter">确定
                            </button>
                        </div>
                    </form>
                </div>
            </div>
            <div class="layui-card">
                <div class="layui-card-header">高拍仪</div>
                <div class="layui-card-body">
                    <form class="layui-form" action="" onsubmit="return false">
                        <div class="layui-form-item">
                            <label class="layui-form-label">开关设置</label>
                            <div class="layui-input-block">
                                <input type="radio" name="altimeter" value="1" title="开">
                                <input type="radio" name="altimeter" value="0" title="关">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="altimeterSave">保存</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-row layui-col-space10">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <table id="host-table" lay-filter="host-table"></table>
                </div>
            </div>
        </div>
    </div>
    <script type="text/html" id="role-bar">
        <button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit"><i
                class="layui-icon layui-icon-edit"></i></button>
        <button class="pear-btn pear-btn-danger pear-btn-sm" lay-event="remove"><i
                class="layui-icon layui-icon-delete"></i></button>
    </script>
    <script type="text/html" id="host-toolbar">
        <button class="pear-btn pear-btn-primary pear-btn-md" lay-event="add">
            <i class="layui-icon layui-icon-add-1"></i>
            新增
        </button>
    </script>
</div>
<script src="/component/layui/layui.js"></script>
<script src="/component/pear/pear.js"></script>
<script th:inline="javascript">
    var numberOfColumns = parseInt([[${numberOfColumns}]]);
    var $ = layui.jquery;
    var RFID = [[${RFID}]]
    if (RFID == '0') {
        $("#rfidReading").css("display", "none")
    }

    //验证是否超过最大值
    function checkVal() {
        let val = $("#LED").val();
        if (val > numberOfColumns) {
            val = numberOfColumns;
        } else if (val < 0) {
            val = 0;
        }
        $("#LED").val(val);
    }

    layui.use(['form', 'element', "button", 'laydate', "popup", 'table'], function () {
        var form = layui.form;
        var $ = layui.jquery;
        var laydate = layui.laydate;
        var button = layui.button;
        var popup = layui.popup;
        let table = layui.table;

        let cols = [
            [
                {title: '主机ip', field: 'ip', align: 'center'},
                {title: '编号', field: 'number', align: 'center'},
                {title: '操作', toolbar: '#role-bar', align: 'center', width: 130}
            ]
        ]

        tableIns = table.render({
            elem: '#host-table',
            url: '/setting/host/ip/list',
            page: true,
            cols: cols,
            skin: 'line',
            toolbar: '#host-toolbar',
            // defaultToolbar: [{
            //     title: '刷新',
            //     layEvent: 'refresh',
            //     icon: 'layui-icon-refresh',
            // }, 'filter', 'print', 'exports'],
            id: 'testReload',
            //解决页码的问题
            done: function (res) {
                // 获得当前页码
                var brforeCurr = tableIns.config.page.curr;
                // 获得当前页的记录数
                var dataLength = table.cache['testReload'].length;
                var count = res.count; // 获得总记录数
                //如果当前页的记录数为0并且总记录数不为0
                if (dataLength == 0 && count != 0) {
                    // 刷新表格到上一页
                    table.reload("testReload", {
                        page: {
                            curr: brforeCurr - 1
                        }
                    });
                }
            }
        })

        table.on('tool(host-table)', function (obj) {
            if (obj.event === 'remove') {
                window.remove(obj);
            } else if (obj.event === 'edit') {
                window.edit(obj);
            }
        });
        table.on('toolbar(host-table)', function (obj) {
            if (obj.event === 'add') {
                window.add();
            }
        });
        // 新增主机
        window.add = function () {
            layer.open({
                type: 2,
                title: '新增',
                shade: 0.1,
                area: ['500px', '400px'],
                content: "/setting/host/add"
            });
        }
        //主机信息修改
        window.edit = function (obj) {
            var data = obj.data;
            layer.open({
                type: 2,
                title: '修改',
                shade: 0.1,
                area: ['500px', '500px'],
                content: '/setting/host/edit/?hostId=' + data.id
            });
        }
        // 单行删除功能
        window.remove = function (obj) {
            layer.confirm('确定要删除该主机', {icon: 3, title: '提示'}, function (index) {
                layer.close(index);
                let loading = layer.load();
                $.ajax({
                    url: "/setting/host/remove/" + obj.data['id'],
                    dataType: 'json',
                    type: 'delete',
                    success: function (result) {
                        layer.close(loading);
                        if (result.code == 200) {
                            layer.msg(result.message, {icon: 1, time: 2000}, function () {
                                obj.del();
                                table.reload("testReload");
                            });
                        } else {
                            layer.msg(result.message, {icon: 2, time: 2000});
                        }
                    }
                })
            });
        }
        // 时间校准
        laydate.render({
            elem: '#time', //指定元素
            type: 'datetime',
            theme: '#393D49'
        });

        // led
        form.on('submit(ledSubmit)', function (data) {
            request("/setting/send/led", data);
        })
        //led LED依次亮
        form.on('submit(ledTurnsOnInTurn)', function (data) {
            request("/setting/ledTurnsOnInTurn", data);
        })

        //层位置设置
        form.on('submit(pulseSubmit)', function (data) {
            request("/setting/pulse/save", data);
        })

        //重启控制器
        $("[load]").click(function () {
            button.load({
                elem: '[load]',
                time: 600,
                done: function () {
                    request("/setting/restart/controller", {})
                }
            })
        })

        function request(url, data) {
            let loading = layer.load();
            let dataParams = null;
            if (data != null) {
                dataParams = data.field;
            } else {
                dataParams = {}
            }
            $.ajax({
                url: url,
                dataType: 'json',
                type: 'POST',
                contentType: "application/json;charset=utf-8",
                data: JSON.stringify(dataParams),
                success: function (result) {
                    layer.close(loading);
                    if (result.code == 200) {
                        layer.msg(result.message, {
                            icon: 1,
                            time: 3000
                        });
                    } else {
                        layer.msg(result.message, {
                            icon: 2,
                            time: 3000
                        });
                    }
                }
            });
        }

        // 设置屏幕尺寸
        form.on('submit(setScreenSize)', function (data) {
            request("/setting/screen/size", data);
        })

        // 恢复初始密码:
        form.on('submit(restoreInitialPassword)', function (data) {
            request("/setting/rest/password", data);
        })


        //参数提交
        form.on('submit(datetimeSave)', function (data) {
            request("/setting/datetime/save", data)
        })
        //参数提交
        form.on('submit(parameterSettings)', function (data) {
            request("/setting/parameter/save", data)
        })
        //设置柜体层数提交
        form.on('submit(cabinetLayers)', function (data) {
            request("/setting/cabinetLayers/save", data)
        })
        //设置柜体列数提交
        form.on('submit(numberOfCabinetColumns)', function (data) {
            request("/setting/cabinet/save", data)
        })
        //RFID提交
        form.on('submit(RFIDSave)', function (data) {
            if (data.field.RFID == '0') {
                $("#rfidReading").css("display", "none");
            } else {
                $("#rfidReading").css("display", "");
            }
            request("/setting/RFID/save", data);
        })
        // 层设置 layerSettings
        form.on('submit(layerSettings)', function (data) {
            request("/setting/layer/save", data);
        })
        // 设置用户密码 userPassword
        form.on('submit(userPassword)', function (data) {
            request("/setting/userPassword/save", data);
        });
        //温湿度预警保存
        form.on('submit(alertSave)', function (data) {
            request("/setting/alert/Save", data);
        });
        // 调试模式保存
        form.on('submit(debugSave)', function (data) {
            request("/setting/debug/save", data);

        });
        // RFID 实时读取
        form.on('submit(realTimeRead)', function (data) {
            request("/setting/rfid/realtime/read/save", data);
        });
        // 系统调试设置
        form.on('submit(motorTypeSave)', function (data) {
            request("/setting/motor/type/save", data);
        });
        // 登录方式
        form.on('submit(loginTypeSave)', function (data) {
            request("/setting/login/type/save", data);
        });
        //更新参数
        form.on('submit(updateAllParameter)', function (data) {
            request("/setting/update/all/parameter", data);
            parent.layui.admin.refreshThis()
        })
        // 高拍仪保存
        form.on('submit(altimeterSave)', function (data) {
            request("/setting/altimeter/save", data);
        })
    });
</script>
</body>
</html>